// 管理所有与登录相关的接口
import http from './utils/http'

/**
 * 小程序登录：返回数据的类型
 */
// export interface LoginWxMinResult {
//   account: string
//   avatar: string
//   id: number
//   mobile: string
//   nickname: null | string
//   token: string
// }
interface Login{
	code: string
	mobile: string
	password: string
}
export interface LoginTokenResult {
  openid: string
  sessionKey: string
}
export interface RefreshTokenResult {
  access_token: string
  access_token_expire: number
}

export function loginCode(data: Login): Promise<any> {
  return http.post('/login', data)
}

export function loginAvoidCode(code: string): Promise<any> {
  return http.post('/code-login', {
	  code: code
  })
}

export const useLogoutApi = () => {
  return http.post('/app/auth/logout')
}
export const useAuthenticationApi = (data: any) =>{
	return http.post("/driver/filed", data)
}

